package com.hl.web.fore;

import com.hl.pojo.ConsultantExcellence;
import com.hl.pojo.ConsultantLevel;
import com.hl.service.ConsultantExcellenceService;
import com.hl.service.ConsultantLevelService;
import com.hl.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/consultantExcellence")
public class ConsultantExcellenceController {
    @Autowired
    private ConsultantExcellenceService consultantExcellenceService;

    @PostMapping("/add")
    public ResultEntity add(@RequestBody ConsultantExcellence consultantExcellence) {
        consultantExcellenceService.add(consultantExcellence);
        return ResultEntity.ok();
    }
    @GetMapping("/findAll")
    public ResultEntity findAll() {
        return ResultEntity.ok(consultantExcellenceService.findAll());
    }

    @GetMapping("/del")
    public ResultEntity del( Integer consultantId,Integer excellenceId) {
        consultantExcellenceService.del(consultantId,excellenceId);
        return ResultEntity.ok();
    }
    @GetMapping("/findByConsultantId")
    public ResultEntity findByConsultantId(Integer consultantId) {
        return ResultEntity.ok(consultantExcellenceService.findByConsultantId(consultantId));
    }
    @GetMapping("/findByExcellenceId")
    public ResultEntity findByExcellenceId(Integer excellenceId) {
        return ResultEntity.ok(consultantExcellenceService.findByExcellenceId(excellenceId));
    }
    @GetMapping("/update")
    public ResultEntity update(Integer newExcellenceId , Integer consultantId , Integer oldExcellenceId) {
        consultantExcellenceService.update(newExcellenceId, consultantId ,oldExcellenceId);
        return ResultEntity.ok();
    }
}
